package com.life.ai.server.common.exception;

import cn.hutool.core.util.StrUtil;
import com.life.ai.server.common.exception.errorcode.BaseErrorCode;
import com.life.ai.server.common.exception.errorcode.IErrorCode;
import lombok.ToString;

/**
 * RemoteException
 *
 * @author kylewka
 * @since 2024/6/19
 */
@ToString
public class RemoteException extends AbstractException {

    public RemoteException(String message, Object... args) {
        this(BaseErrorCode.REMOTE_ERROR, message, args);
    }

    public RemoteException(IErrorCode errorCode) {
        this(errorCode, errorCode.getMessage());
    }

    public RemoteException(IErrorCode errorCode, String message, Object... args) {
        super(errorCode, StrUtil.format(message, args));
    }
}
